<template>
  <div class="main" v-show="mainShow"></div>
</template>

<script>
/* eslint-disable */
import pubsub from "pubsub-js";
import { getCurrentInstance, onMounted, ref, toRef } from "vue";

export default {
  name: "identifyResult",
  data() {
    return {
      mainShow: true,
    };
  },
  setup() {
    const proxy = getCurrentInstance();
    let subList = [];

    onMounted(() => {
      subList.push(
        pubsub.subscribe("identifyData", (n, data) => {
          console.log(data);
        }),
        pubsub.subscribe("clickIdentify", (n, data) => {
          if (!data) {
            proxy.mainShow = false;
          }
        })
      );
    });

    return {
      subList,
    };
  },
  beforeDestroy() {
    this.subList.forEach((element) => {
      pubsub.unsubscribe(element);
    });
  },
};
</script>

<style lang="less" scoped>
.main {
  background-color: aliceblue;
  position: absolute;
  z-index: 9999;
  left: 0%;
  top: 15%;
  height: 70%;
  width: 20%;
}
</style>